//
//  OrderTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/6.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "OrderTableViewCell.h"

@implementation OrderTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    self.backgroundColor = UIColorFromRGB(0xf5f5f5);
    WeakSelf
    self.goodsImg = [[UIImageView alloc] init];
    _goodsImg.image = UIImageNamed(@"salesGoods");
    [self addSubview:_goodsImg];
    [_goodsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(rateWidth(30));
        make.centerY.equalTo(self);
        make.size.mas_offset(CGSizeMake(rateWidth(150), rateWidth(150)));
    }];
    
    self.goodsTitleLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x323232) fontSize:15];
    _goodsTitleLB.numberOfLines = 0;
    [self addSubview:self.goodsTitleLB];
    [_goodsTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.goodsImg.mas_right).offset(rateWidth(20));
        make.width.lessThanOrEqualTo(@(rateWidth(400)));
        make.top.equalTo(weakSelf.goodsImg).offset(rateHeight(10));
        make.height.mas_lessThanOrEqualTo(@(rateHeight(100)));
    }];
    
    self.priceLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x323232) fontSize:15];
    [_priceLB sizeToFit];
    [self addSubview:_priceLB];
    [_priceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-rateWidth(30));
        make.top.equalTo(weakSelf.goodsImg).offset(rateHeight(10));
    }];
    
    self.describeLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x909090) fontSize:15];
    [_describeLB sizeToFit];
    [self addSubview:_describeLB];
    [_describeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.goodsTitleLB);
        make.top.equalTo(weakSelf.goodsTitleLB.mas_bottom).offset(rateHeight(15));
    }];
    
    self.numLB = [UILabel labelWithText:@"×1" textColor:UIColorFromRGB(0x909090) fontSize:15];
    [_numLB sizeToFit];
    [self addSubview:_numLB];
    [_numLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf.priceLB);
        make.top.equalTo(weakSelf.priceLB.mas_bottom).offset(rateHeight(25));
    }];
    
}

@end
